package cn.wolfcode.enums;

import lombok.Getter;

@Getter
public enum BusinessReportGroupTypeEnum {
    B_NAME("门店","b.name"),
    YEAR("年","DATE_FORMAT(c.create_time,'%Y')"),
    MOTHER("月","DATE_FORMAT(c.create_time,'%Y-%m')"),
    DAY("日","DATE_FORMAT(c.create_time,'%Y-%m-%d')");

    private String name;//对应的名字
    private String value;//存在数据库的状态数字

    //缺省的全参数构造器
    BusinessReportGroupTypeEnum(String name, String value) {
        this.name = name;
        this.value = value;
    }

    //根据value找到name
    public static String findName(String value){
        BusinessReportGroupTypeEnum[] enums = BusinessReportGroupTypeEnum.values();
        for (BusinessReportGroupTypeEnum anEnum : enums) {
            if(anEnum.getValue().equals(value)){
                return anEnum.getName();
            }
        }
        return null;
    }
}
